home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Atari Mega Archive 1
/
Atari Mega Archive - Volume 1.iso
/
gnu
/
othergnu
/
ms.zoo
/
crtsg.s
< prev
next >
Wrap
Text File
|
1989-04-27
|
1KB
|
42 lines
/
/ ST C run time startup.
/
/ Stripped version for gem tos/aes/vdi environment:
/ main called with argc == argv == envp == 0,
/ getenv will not work
/ file handle 2 left pointing where ever it does,
/
.prvd
.globl _stksize_
.globl _start_
/
/ a1 = end of bssd
/ a5 = base page pointer
/ _stksize_ = a long size for stack allocation
/ overwritten at runtime to make a stack limit
/ _start_ = program text base
/
.shri
_start_:
movea.l 4(a7), a5 / Fetch base page pointer
movea.l 24(a5), a1 / Fetch bss base
adda.l 28(a5), a1 / + size of bss
/ Allocate stack, a1 points beyond vectors
adda.l _stksize_, a1 / Allocate _stksize_ bytes of stack
movea.l a1, a7 / Set the initial stack.
/ Release unused memory to the system pool.
suba.l a5, a1 / Compute size of retained memory
move.l a1, -(a7)
move.l a5, -(a7) / Base of retained memory
clr -(a7) / Must be zero
move $0x4A, -(a7) / Mshrink opcode
trap $1 / Gemdos
adda $12, a7 / Pop arguments
/ Call main(argc, argv, envp)
suba a6, a6 / Zero frame pointer
jsr main_ / Call main line
/ Exit with return from main
clr -(a7) / Pterm0()
trap $1